package cn.webestar.scms.task.svcapi;

import cn.webestar.scms.commons.R;
import cn.webestar.scms.commons.api.PageVO;
import cn.webestar.scms.microsvc.controller.BaseController;
import cn.webestar.scms.task.api.TaskApi;
import cn.webestar.scms.task.api.dto.Task.*;
import cn.webestar.scms.task.entity.Task;
import cn.webestar.scms.task.service.TaskService;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 任务
 */
@RestController
@RequestMapping("/svcapi/Task")
public class TaskSvcController extends BaseController<Task, String> implements TaskApi {

    @Autowired
    private TaskService service;

    @Override
    public IService<Task> getService() {
        return service;
    }

    @Override
    @PostMapping("/delete")
    public R<Boolean> delete(@RequestParam("id") String id) {
        return super._delete(id);
    }

    @Override
    @PostMapping("/findById")
    public R<Task> findById(@RequestParam("id") String id) {
        return super._findById(id);
    }

    @Override
    @PostMapping("/findByIds")
    public R<Map<String, Task>> findByIds(@RequestBody Set<String> ids) {
        return super._findByIds(ids);
    }

    @Override
    @PostMapping("/create")
    public R<Task> create(@RequestBody TaskCreateDTO body) {
        return super._create(body);
    }

    @Override
    @PostMapping("/update")
    public R<Task> update(@RequestBody TaskUpdateDTO body) {
        return super._update(body);
    }

    @Override
    @PostMapping("/page")
    public R<PageVO<Task>> page(@RequestBody TaskPageDTO body) {
        return super._page(body);
    }

    @Override
    @PostMapping("/findOne")
    public R<Task> findOne(@RequestBody TaskSimpleDTO body) {
        return super._findOne(body);
    }

    @Override
    @PostMapping("/limitList")
    public R<List<Task>> limitList(@RequestBody TaskLimitDTO body) {
        return super._limitList(body);
    }

}
